﻿using System;
using System.Collections.Generic;
//
namespace PerceptiveMCAPI.Types
{
	#region "Multi-use"

	// =============================================
	public class interestGroupings
	{
		public int id { get; set; }
		public string name { get; set; }
		public List<string> groups { get; set; }
		//-------
		public interestGroupings()
		{
			groups = new List<string>();
		}
	}

	public class mergevar_options
	{
		public EnumValues.field_Type field_type { get; set; }
		public bool req { get; set; }
		public bool @public { get; set; }
		public bool show { get; set; }
		public string default_value { get; set; }
		public List<string> choices { get; set; }
		//
		public mergevar_options()
		{
			this.field_type = MCAPISettings.default_listMergeVarAdd_field_type;
			this.req = MCAPISettings.default_listMergeVarAdd_req;
			this.@public = MCAPISettings.default_listMergeVarAdd_public;
			this.show = MCAPISettings.default_listMergeVarAdd_show;
			this.choices = new List<string>();
		}
	}

	public class campaignSegmentOptions
	{
		public string match { get; set; }
		public List<campaignSegmentCondition> conditions { get; set; }

		public campaignSegmentOptions()
		{
			conditions = new List<campaignSegmentCondition>();
		}
	}
	public class campaignSegmentCondition
	{
		public string field { get; set; }
		public string op { get; set; }
		public string value { get; set; }
		public string extra { get; set; }
	}

	public class campaignCreateOptions
	{
		public string list_id { get; set; }
		public string subject { get; set; }
		public string from_email { get; set; }
		public string from_name { get; set; }
		public string to_name { get; set; }
		public int template_id { get; set; }
		public int gallery_template_id { get; set; }
		public int base_template_id { get; set; }
		public int folder_id { get; set; }
		public campaignTracking tracking { get; set; }
		public string title { get; set; }
		public bool authenticate { get; set; }
		public Dictionary<string, string> analytics { get; set; }
		public bool auto_footer { get; set; }
		public bool inline_css { get; set; }
		public bool generate_text { get; set; }
		public bool auto_tweet { get; set; }
		public bool timewarp { get; set; }
		public bool ecomm360 { get; set; }

		public campaignCreateOptions()
		{
			tracking = new campaignTracking();
			authenticate = MCAPISettings.default_campaign_authenticate;
			analytics = new Dictionary<string, string>();
			auto_footer = MCAPISettings.default_campaign_auto_footer;
			inline_css = MCAPISettings.default_campaign_inline_css;
			generate_text = MCAPISettings.default_campaign_generate_text;
			auto_tweet = MCAPISettings.default_campaign_auto_tweet;
			timewarp = MCAPISettings.default_campaign_timewarp;
			ecomm360 = MCAPISettings.default_campaign_ecomm360;
		}
	}

	public class campaignTracking
	{
		public bool opens { get; set; }
		public bool html_clicks { get; set; }
		public bool text_clicks { get; set; }

		public campaignTracking()
		{
			opens = MCAPISettings.default_campaign_tracking_opens;
			html_clicks = MCAPISettings.default_campaign_tracking_html_clicks;
			text_clicks = MCAPISettings.default_campaign_tracking_text_clicks;
		}
		public campaignTracking( bool opens, bool html_clicks, bool text_clicks )
		{ this.opens = opens; this.html_clicks = html_clicks; this.text_clicks = text_clicks; }
	}

	// --------------------------------------------------------------------------------------
	// used for base classes for campaignEcommOrderAdd, campaignEcommOrders, 
	// and ecommOrderAdd, ecommOrderDel, ecommOrders
	// some fields are not used everywhere, and are ignored were appropriate

	public class ecommOrder
	{
		public string order_id { get; set; }
		public DateTime order_date { get; set; }
		public string campaign_id { get; set; }
		public string plugin_id { get; set; }
		public string email_id { get; set; }
		public string email { get; set; }
		public double total { get; set; }
		public double shipping { get; set; }
		public double tax { get; set; }
		public string store_id { get; set; }
		public string store_name { get; set; }
		public List<orderItem> items { get; set; }
		//
		public ecommOrder()
		{
			items = new List<orderItem>();
			order_date = DateTime.MinValue;
		}
		// ----------------------------------------
		public class orderItem
		{
			public int line_num { get; set; }
			public int product_id { get; set; }
			public string product_name { get; set; }
			public string product_sku { get; set; }
			public int category_id { get; set; }
			public string category_name { get; set; }
			public double qty { get; set; }
			public double cost { get; set; }
		}
	}
	#endregion
}